import 'package:Bible/page/list.dart';
import 'package:Bible/global.dart';
import 'package:flutter/material.dart';
import 'package:Bible/page/search.dart';

class IndexPage extends StatefulWidget {
  IndexPage({Key key}) : super(key: key);
  @override
  _IndexPageState createState() => _IndexPageState();
}

class _IndexPageState extends State<IndexPage> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: MediaQuery.of(context).size.width,
      height: MediaQuery.of(context).size.height,
      decoration: BoxDecoration(
        color: Global.backgroundColor,
        image: DecorationImage(
          image: AssetImage("assets/images/main.jpg"),
          repeat: ImageRepeat.repeat,
          fit: BoxFit.fitWidth,
          alignment: Alignment.bottomCenter,
        ),
      ),
      child: Column(
        children: [
          Container(
            padding: EdgeInsets.fromLTRB(0, Global.paddingTop, 0, 10),
            decoration: BoxDecoration(
              color: Global.backgroundColor,
            ),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                SizedBox(width: 58),
                Expanded(
                  child: Center(
                    child: Text(
                      '每日圣经',
                      style: TextStyle(
                        fontFamily: 'fangzhengkai',
                        fontWeight: FontWeight.w700,
                        fontSize: 18,
                        color: Global.fontColor,
                      ),
                    ),
                  ),
                ),
                IconButton(
                  icon: Icon(
                    Icons.search,
                    color: Global.primaryColor,
                    size: 27,
                  ),
                  tooltip: '搜索',
                  onPressed: () {
                    Navigator.push(
                      context,
                      MaterialPageRoute(
                        builder: (context) => SearchPage(),
                      ),
                    );
                  },
                ),
                SizedBox(width: 10),
              ],
            ),
          ),
          Expanded(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                InkWell(
                  onTap: () {
                    Navigator.push(
                      context,
                      MaterialPageRoute(
                        builder: (context) => ListPage(index: 1),
                      ),
                    );
                  },
                  child: Container(
                    padding: EdgeInsets.fromLTRB(40, 20, 40, 10),
                    child: Image.asset('assets/images/2.png'),
                  ),
                ),
                InkWell(
                  onTap: () {
                    Navigator.push(
                      context,
                      MaterialPageRoute(
                        builder: (context) => ListPage(index: 2),
                      ),
                    );
                  },
                  child: Container(
                    padding: EdgeInsets.fromLTRB(40, 20, 40, 10),
                    child: Image.asset('assets/images/1.png'),
                  ),
                ),
              ],
            ),
          ),
          SizedBox(height: 200)
        ],
      ),
    );
  }
}
